function taskSolution() {
    var rows = document.getElementsByTagName('tr');

    for (var i = 0; i < rows.length; i += 2) {
        rows[i].style.display = 'none';
    }
}

var button = document.getElementById('btnHideOddRows');
button.addEventListener('click', taskSolution);